//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<CSlotLayout.h>
///	@path	~/src/graphics/dx9/
///	@date	2008/12/27
///	@desc	.

#pragma once

#include "xeres.h"

#include <vector>

#include "graphics/ISlotLayout.h"
#include "graphics/dx9/CDevice9.h"

namespace xeres {

	// slot layout decl
	struct VertSlotDecl
	{
		uint offset;
		size_t size;
	};

	/*! 
		\class	CSlotLayout
		\brief	Stores per slot layout of a vertex declaration.
	*/
	class CSlotLayout : public ISlotLayout
	{
	public:

		/// \ctor
		CSlotLayout( size_t size , const std::vector<VertSlotDecl>& layout );

		/// \dtpr
		virtual ~CSlotLayout( void );

		DECL_IOBJECT_CLASS( CSlotLayout , ISlotLayout );

	public:

	// @interface

		/// \impl
		virtual size_t GetLayoutSize( void );

		/// \impl
		virtual bool ExpandData( uint index , const byte * input , size_t input_size , byte * output );

		/// \impl
		virtual bool StreamData( const byte * input , size_t stride , size_t count , byte * output );

		/// \brief		Get slot decls.
		const std::vector<VertSlotDecl> GetDecls( void ) const { return m_layout; }

	private:

	//@ data

		// size in byte of declaration
		size_t m_size;

		// transformation of data
		std::vector<VertSlotDecl>	m_layout;

	};

} // namespace xeres
